package com.appwoo.txtws.wheel.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ProgressBar;

public class TextProgressBar extends ProgressBar
{
  private Paint mPaint;
  private String text;

  public TextProgressBar(Context paramContext)
  {
    super(paramContext);
    initText();
  }

  public TextProgressBar(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    initText();
  }

  public TextProgressBar(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    initText();
  }

  private void initText()
  {
    this.mPaint = new Paint();
    this.mPaint.setColor(-1);
    this.mPaint.setTextSize(18.0F);
  }

  private void setText(int paramInt)
  {
    this.text = (String.valueOf(Math.round(100.0F * (paramInt / getMax()))) + "%");
  }

  @SuppressLint({"DrawAllocation"})
  protected void onDraw(Canvas paramCanvas)
  {
    try
    {
      super.onDraw(paramCanvas);
      Rect localRect = new Rect();
      this.mPaint.getTextBounds(this.text, 0, this.text.length(), localRect);
      int i = getWidth() / 2 - localRect.centerX();
      int j = getHeight() / 2 - localRect.centerY();
      paramCanvas.drawText(this.text, i, j, this.mPaint);
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void setProgress(int paramInt)
  {
    try
    {
      setText(paramInt);
      super.setProgress(paramInt);
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.wheel.widget.TextProgressBar
 * JD-Core Version:    0.6.2
 */